<%@page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/jsp/include.jsp" %>
<link href="../images/skin.css" rel="stylesheet" type="text/css" />
<link href="../images/fox.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=syscontextPath %>/js/jquery/jquery-1.3.2.min.js "></script>
<script type="text/javascript" src="<%=syscontextPath %>/js/My97DatePicker/WdatePicker.js" ></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>js/nyroModal-1.6.2/styles/nyroModal.css" type="text/css" media="screen" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/nyroModal-1.6.2/js/jquery.nyroModal-1.6.2.min.js"></script>
<script type="text/javascript" src="<%=syscontextPath %>/js/pub/city.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/pub/pub.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #F8F9FA;
}
-->
</style>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="<%=syscontextPath %>/images/mail_leftbg.gif"><img src="<%=syscontextPath %>/images/left-top-right.gif" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="<%=syscontextPath %>/images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">经销商列表</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="<%=syscontextPath %>/images/mail_rightbg.gif"><img src="<%=syscontextPath %>/images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="<%=syscontextPath %>/images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td class="left_txt">当前位置：经销商列表</td>
          </tr>
          <tr>
            <td height="20"><table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
              <tr>
                <td></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><table width="100%" height="55" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="10%" height="55" valign="middle"><img src="<%=syscontextPath %>/images/title.gif" width="54" height="55"></td>
                <td width="90%" valign="top"><span class="left_txt2">在这里，您看到的是经销商列表信息！</span></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
              <tr>
                <td class="left_bt2">
						<form name="form1" method="post" action="<%=syscontextPath %>/basicinfo/dealerlist">
						城市:<select name="cityid" id="province"></select>&nbsp;&nbsp;经销商名称：<input type="text" name="name" value="${dealer.name}">&nbsp;&nbsp;企业地址:<input type="text" name="address" value="${dealer.address}">&nbsp;&nbsp;<input class="smallBtnt" name="Button1" type="submit" value="查 询" />
						</form>
						</td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td>
                <table width="100%" height="90" border="0" cellpadding="0" cellspacing="0">
                  <tr >
                    <td colspan="5" align="center" bgcolor="#f2f2f2" class="tda">
                    	&nbsp;
					</td>
                    </tr>
                    <tr height="40">
			            <td width="7%" height="27" align="center"  class="tda" >选择</td>
			            <td align="center"  class="tda">经销商名称</td>
			            <td align="center" class="tda">经销商地址</td>
			            <td align="center" class="tda">注册时间</td>
			          </tr>
			          <c:forEach var="rs" items="${page.result}" varStatus="status">
			          	<c:choose>
							<c:when test="${status.count % 2 != 0}">
								<tr bgcolor="#f2f2f2" >
							</c:when>
							<c:otherwise>
								<tr>
							</c:otherwise>
						</c:choose> 
			            <td align="center"  class="tda"><input name="orderidbox" type="radio" value="${rs.id}" <c:if test="${status.index == 0}">checked='true'</c:if>/></td>
			            <td align="left"  class="tda">${rs.name}&nbsp;</td>
			            <td align="left"  class="tda">${rs.address}&nbsp;</td>
			            <td align="left"  class="tda">${rs.createdate}&nbsp;</td>
			          </tr>
			          </c:forEach>
                  <tr >
                    <td colspan="4" align="right" bgcolor="#f2f2f2" class="tda">
                    <div >
                    <a href="<%=syscontextPath %>/basicinfo/addDealer/0" class="nyroModal" id="addcomp">新增</a>&nbsp;&nbsp;
                    <a href="#" onclick="editcomp();return false;"  id="editcomp">修改</a>&nbsp;&nbsp;
                    <a href="#" onclick="delcompany();return false;">删除</a>&nbsp;&nbsp;
							<span class="fred">${page.currentPage}/${page.totalPage}</span> 共 ${page.totalRecords} 条
							<a href="javascript:Gopage(1)">首页</a> 
							<c:if test="${page.hasPrePage}"><a href="javascript:Gopage(${page.prepage})">上一页</a></c:if>
							<c:if test="${page.hasNextPage}"><a href="javascript:Gopage(${page.nextpage})">下一页</a></c:if>
							<a href="javascript:Gopage(${page.totalPage})">尾页</a>
							<input typt="text" name="go_page_no" id="go_page_no" size="3"><input type="button" value="Go" onclick="page_go()">
					</div>
                    </td>
                    </tr>
                </table>
             </td>
          </tr>
        </table>
          </td>
      </tr>
    </table></td>
    <td background="<%=syscontextPath %>/images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="<%=syscontextPath %>/images/mail_leftbg.gif"><img src="<%=syscontextPath %>/images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="<%=syscontextPath %>/images/buttom_bgs.gif"><img src="<%=syscontextPath %>/images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="<%=syscontextPath %>/images/mail_rightbg.gif"><img src="<%=syscontextPath %>/images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
<script type="text/javascript">
<!--
function getcity(){
	var html = "<option value='86'>全国</option>";
	var cityid = "${dealer.cityid}";
	for(var i=0;i<Citys.length;i++){
		if(cityid == Citys[i][0]){
			html += "<option value='" + Citys[i][0] + "' selected='true'>" + Citys[i][1] + "</option>";
		}else{
        	html += "<option value='" + Citys[i][0] + "'>" + Citys[i][1] + "</option>";
		}
    }
    return html;
} 
jQuery(function($) {
    <%String msg=	request.getParameter("msg");%>
      var msg="<%=msg%>";
      var msg1="${msg}";
	if(msg!=""&&msg!='null') {
		alert(msg);
	}else if(msg1!=""){
		alert(msg1);
	}
	$('#province').append(getcity());;
});
//增加企业信息
function addcompany(){
	location.href="<%=syscontextPath %>/basicinfo/addcompany/0";
}

//删除企业信息
function delcompany(){
	var id = $("input[name='orderidbox']:checked").val();
	if(confirm("确定要删除吗？")){
		//异步删除 
		$.post("<%=syscontextPath %>/basicinfo/cudDealer/0",{id:id},function(data){
			if(data){
				alert("删除成功！");
				location = location;
			}else{
				alert("删除失败！");
				return false;
			}	
		},"json");
	}else{
		return false;
	}
}

function editcomp(){
	var id = $("input[name='orderidbox']:checked").val();
	var url="<%=syscontextPath %>/basicinfo/addDealer/1?id="+id;
	$('#editcomp').attr("href",url);
	$('#editcomp').nyroModalManual();
}

//分页跳转
function Gopage(pageno){
		location.href="<%=syscontextPath %>/basicinfo/dealerlist?pageno="+pageno;
	}
//-->
</script>
